using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Shop;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
public class Passport_ActiveAccount : Shop, IRequiresSessionState
{
	private UserBll _user;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected UserBll m_User
	{
		get
		{
			UserBll user;
			if (this._user == null)
			{
				this._user = new UserBll(this.conn);
				user = this._user;
			}
			else
			{
				user = this._user;
			}
			return user;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		bool flag = false;
		string text = "";
		if (Fetch.Get("CheckNum", "string") != string.Empty && Fetch.Get("UserName") != string.Empty)
		{
			string checkNum = base.Server.HtmlEncode(Fetch.Get("CheckNum"));
			string text2 = base.Server.HtmlEncode(Fetch.Get("UserName"));
			if (Fetch.Get("CheckType") == "email")
			{
				text = "ConfirmEmail";
			}
			else
			{
				text = "ActiveAccount";
			}
			DataTable userByUserName = this.m_User.GetUserByUserName("vgoshop");
			if (userByUserName.Rows.Count > 0)
			{
				if (userByUserName.Rows[0]["CheckNum"].ToString() != null)
				{
					if (this.m_User.ActiveAccount(userByUserName.Rows[0]["UserName"].ToString(), checkNum, text))
					{
						flag = true;
					}
				}
			}
		}
		if (flag)
		{
			if (text == "ConfirmEmail")
			{
				this.WriteSuccessMsg("", Language.Get("PassPort/BindEmailOK"), this.config["SiteUrl"].ToString());
			}
			this.WriteSuccessMsg("", Language.Get("PassPort/ActiveAccountOK"), this.config["SiteUrl"].ToString());
		}
		else
		{
			if (text == "ConfirmEmail")
			{
				this.WriteSuccessMsg("", Language.Get("PassPort/BindEmailFail"), this.config["SiteUrl"].ToString());
			}
			this.WriteErrMsg("", Language.Get("PassPort/ActiveAccountFail"), this.config["SiteUrl"].ToString());
		}
	}
}
